//
//  main.cpp
//  CS106_Proj1
//
//  Created by Paul Walter on 19/10/14.
//  Copyright (c) 2014 Paul Walter. All rights reserved.
//

#include <iostream>
#include <vector>

using namespace std;

void FindDivisors(int target, vector<int> & vect)
{
    // create and return a list for each divisor.
    for(int i = 1; i<target; i++ )
    {
        if(target % i == 0)
            vect.push_back(i);
    }
}


bool IsPerfect(int target)
{
    vector<int> divisors;
    FindDivisors(target, divisors);
    
    int total=0;
    
    for(int y = 0; y<divisors.size(); y++ )
    {
        total += divisors.at(y);
    }
    
    if(total == target)
        return true;
    
    return false;
}


int main(int argc, const char * argv[])
{
    
    // Find Perfect Numbers
    cout << "Part 1: Finding Perfect Numbers:\n";
    for(int y = 1; y<=10000; y++ )
    {
        if(IsPerfect(y))
            cout << "\n\t " << y;
    }
    
    
    
    return 0;
}

